package com.neo.demo2.service.impl;

import com.neo.demo2.domain.Category;
import com.neo.demo2.mapper.CategoryMapper;
import com.neo.demo2.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: chenb
 * @CreateTime: 2024/3/20 13:39
 * @Description:
 */
@Service
public class CategoryServiceImpl implements CategoryService {

  //因为主类的@MapperScan方法，所以自动为CategoryMapper装配了一个categoryMapper对象
  @Autowired
  private CategoryMapper categoryMapper;


  @Override
  public int add(Category category) {
    categoryMapper.insert(category);
    int id = category.getId();
    return id;
  }
}
